class Solution:
    def maxProfit(self, prices):
        """
        :type prices: List[int]
        :rtype: int
        """
        if len(prices) == 0:
            return 0
        mininum = 0
        ele = prices[0]
        for i in range(1, len(prices)):
            if prices[i] < ele:
                ele = prices[i]
            elif prices[i] > ele:
                mininum = max(mininum, prices[i]-ele)
        return mininum
